/*
 @Date: 2022/4/29
 @Desc: 导航控制器
 */

import UIKit

class IPBaseNavigationController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad() 
        configureAppearance()
    }

    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        if viewControllers.count > 0 {
            viewController.hidesBottomBarWhenPushed = true
        }
        super.pushViewController(viewController, animated: animated)
    }
}

extension IPBaseNavigationController {
    
    func configureAppearance(){
        let clear = UIImage()
        let app = UINavigationBarAppearance()
        app.backgroundColor = UIColor.white
        let titleDict: [NSAttributedString.Key: Any] = [.font: UIFont.systemFont(ofSize: 17),
                                                        .foregroundColor: UIColor.black]
        app.backgroundColor = UIColor.white
        app.titleTextAttributes = titleDict
        app.shadowImage = clear
        
        navigationBar.standardAppearance = app
        navigationBar.scrollEdgeAppearance = app
    }
    
}
